#pragma once
#ifndef _YAML__H
#define _YAML__H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "rtc.h"
#include "cstr.h"

enum{
    BUFFER_INITIAL_SIZE = 2048,
};

typedef struct yaml_parser_s{
    cstr_t str_doc;  // string load from a file
    queue_t token;   // tokens of yaml-string
} yaml_parser_t;

typedef struct yaml_document_s{
    int t;
} yaml_document_t;

typedef struct yaml_event_s{
    int t;
} yaml_event_t;

typedef struct scalar_s{
    cstr_t name;
    cstr_t value;
} scalar_t;

// typedef struct 

typedef struct yaml_node_s{
    int node_type;
} yaml_node_t;


int yaml_parser_initialize(yaml_parser_t *parser);

void yaml_parser_delete(yaml_parser_t *parser);

void yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file);

int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event);

int yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);

yaml_node_t* yaml_document_get_root_node(yaml_document_t *document);

void yaml_document_delete(yaml_document_t *document);

#endif  // _YAML__H
